A user can control an application program by interacting with the application program via its graphical user interface (GUI). An application program may provide for the recording of a macroinstruction (sometimes termed a “macro”), which is a recording of the steps taken by the user in controlling the application through its GUI. The macro may be replayed at a later time to control the application program in the same way as the user had done at the time the recording was made. When an application program provides an application programming interface (API), the application program may be also controlled by another computer program via the API.